home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970626-19970929 / 000147_news@newsmaster….columbia.edu _Tue Aug 12 12:21:57 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id MAA19508
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Tue, 12 Aug 1997 12:21:56 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id MAA00527
  7.     for kermit.misc@watsun; Tue, 12 Aug 1997 12:21:55 -0400 (EDT)
  8. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: Kermit macro question
  12. Date: 12 Aug 1997 16:21:54 GMT
  13. Organization: Columbia University
  14. Lines: 43
  15. Message-ID: <5sq2j2$40p$1@apakabar.cc.columbia.edu>
  16. References: <5soa33$9a8$1@gte1.gte.net>
  17. NNTP-Posting-Host: watsun.cc.columbia.edu
  18. Xref: news.columbia.edu comp.protocols.kermit.misc:7448
  19.  
  20. In article <5soa33$9a8$1@gte1.gte.net>,  <dabolts@gte.net> wrote:
  21. : Can you define/assign a macro that contains a variable in the name?  For
  22. : example:
  23. : define \%a 1
  24. : define MESS_\%a This is message 1
  25. : where the macro should be named MESS_1 and contain "This is message 1"
  26. It depends on which Kermit program you are talking about, and which version
  27. of it.  In the current versions of MS-DOS Kermit, Kermit 95, and C-Kermit,
  28. the commands for this are _DEFINE and _ASSIGN, which do the same things as
  29. their unprefixed counterparts, except that they allow construction of the
  30. variable name in the manner you've shown:
  31.  
  32.   define \%a 1
  33.   _define MESS_\%a This is message 1
  34.   echo \m(MESS_1)
  35.  
  36. However, in this case it looks like you are trying to simulate arrays, and
  37. there is no need for that since we already have arrays:
  38.  
  39.   declare \&m[20] ; Declare an array for 20 messages
  40.   define \&m[1] This is message 1
  41.   define \&m[2] This is message 2
  42.   etc...
  43.  
  44. And of course, the subscript can be a variable:
  45.  
  46.   define \%a 1
  47.   define \&m[\%a] This is message 1
  48.  
  49. or even an expression:
  50.  
  51.   define \%a 1
  52.   define \&m[(\%a+3)/2] This is message 1
  53.  
  54. The 1997 edition of "Using C-Kermit" explains the script and macro language
  55. in detail, with lots of examples:
  56.  
  57.   http://www.columbia.edu/kermit/ck60manual.html
  58.  
  59. - Frank